Skip to content

[madvise] Adapted the code to take care of variable names as we trans… #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

bravindr
Copy link
Contributor

@bravindr bravindr commented Jul 10, 2025

Adapted the code to transition from kernel 6.13 to 6.15 baseline
Refactored iaa configuration script to a single one without any other dependencies

@rakibintel rakibintel requested a review from Copilot July 14, 2025 23:01
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates madvise tests and scripts to support kernel 6.15 sysfs parameter names, consolidates IAA configuration into a single script, and removes dependencies on the old enable_kernel_iaa.sh.

  • Add fallback to reclaim-batchsize when reading compress-batchsize in tests.
  • Refactor IAA configuration: replace enable_kernel_iaa.sh calls with enable_iaa.sh and handle new sysfs variables.
  • Update bpftrace and other collection scripts to use new kernel parameter names (vm.compress-batchsizevm.reclaim-batchsize).

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/madvise/madvise_test.c Fallback from compress-batchsize to reclaim-batchsize and commented out perror calls
tests/madvise/enable_kernel_iaa.sh Add conditional writes for g_comp_wqs_per_iaa, g_wqs_per_iaa, and g_consec_descs_per_gwq
tests/madvise/enable_iaa.sh New unified IAA configuration script replacing enable_kernel_iaa.sh
tests/madvise/collect_single_page.sh Switch to enable_iaa.sh and simplify compression algorithm list
tests/madvise/collect_bpftraces.sh Add sysctl fallback for reclaim-batchsize and adjust error messages
tests/madvise/collect_batch.sh Replace enable_kernel_iaa.sh with enable_iaa.sh
Comments suppressed due to low confidence (1)

tests/madvise/collect_bpftraces.sh:89

  • The error message still references 'compress-batchsize' but this command sets 'reclaim-batchsize'. Update the message to 'Failed to set reclaim-batchsize'.
    sysctl vm.reclaim-batchsize=${CBATCH}  || handle_error "Failed to set compress-batchsize"

@@ -123,6 +123,10 @@ int main(int argc, char **argv)
// Replace the newline character with a null terminator
compressor[newline_pos] = '\0';
int cbatch = read_sysfs("/proc/sys/vm/compress-batchsize");
// NOTE: This is a temporary solution as we transition to the new kernel
if ( cbatch == EXIT_FAILURE ) {
Copy link
Preview

Copilot AI Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using EXIT_FAILURE as a sentinel for read_sysfs failure can collide with a valid value of 1. Consider returning a distinct error code (e.g., -1) or leveraging errno to distinguish failures unambiguously.

Suggested change
if ( cbatch == EXIT_FAILURE ) {
if ( cbatch == -1 ) {

Copilot uses AI. Check for mistakes.

@@ -33,7 +33,7 @@ long read_sysfs(char *path ){
FILE* fp = fopen(path, "r");
char buf[128];
if (!fp) {
perror("Couldn't open file");
//perror("Couldn't open file");
Copy link
Preview

Copilot AI Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Commented-out perror calls may clutter the code and confuse readers. Consider removing these lines or replacing them with a clear logging statement explaining why errors are suppressed.

Suggested change
//perror("Couldn't open file");
fprintf(stderr, "Error: Couldn't open file %s. Suppressing perror output.\n", path);

Copilot uses AI. Check for mistakes.

if [ -f /sys/bus/dsa/drivers/crypto/g_comp_wqs_per_iaa ];then
echo 1 > /sys/bus/dsa/drivers/crypto/g_comp_wqs_per_iaa || handle_error "did not set g_comp_wqs_per_iaa"
elif [ -f /sys/bus/dsa/drivers/crypto/g_wqs_per_iaa ];then
echo 1 > /sys/bus/dsa/drivers/crypto/g_comp_wqs_per_iaa || handle_error "did not set g_wqs_per_iaa"
Copy link
Preview

Copilot AI Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the elif branch you are writing to g_comp_wqs_per_iaa instead of g_wqs_per_iaa. Update the path to /sys/bus/dsa/drivers/crypto/g_wqs_per_iaa to match the intended file.

Suggested change
echo 1 > /sys/bus/dsa/drivers/crypto/g_comp_wqs_per_iaa || handle_error "did not set g_wqs_per_iaa"
echo 1 > /sys/bus/dsa/drivers/crypto/g_wqs_per_iaa || handle_error "did not set g_wqs_per_iaa"

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants